home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Controller.as < prev    next >
Text File  |  2013-04-24  |  3KB  |  127 lines

  1. class Controller
  2. {
  3.    static var PACKAGING_INTRO_MUSIC_NAME = "packaging_intro";
  4.    static var PACKAGING_MUSIC_NAME = "packaging_loop";
  5.    static var GAME_MUSIC_NAME = "in_game";
  6.    static var nSFX_VOLUME = 60;
  7.    static var nMUSIC_VOLUME = 60;
  8.    static var oRef = null;
  9.    function Controller(_mcTimeline)
  10.    {
  11.       this.bPause = false;
  12.       Controller.oRef = this;
  13.       this.oTransition = new Transition(_mcTimeline.mcTransition);
  14.       this.oMenu = new Menu(_mcTimeline.mcMenu);
  15.       this.oInstructions = new Instructions(_mcTimeline.mcInstructions);
  16.       this.oStartPop = new StartPopUp(_mcTimeline.mcStartPop);
  17.       this.oCheatPop = new CheatPopUp(_mcTimeline.mcCodePop);
  18.       this.oTransitionLevel = new TransitionLevel(_mcTimeline.mcTransitionLevel);
  19.       this.oSounds = new Sounds(_mcTimeline);
  20.    }
  21.    function pauseGame()
  22.    {
  23.       this.bPause = true;
  24.       CTRLGame.getRef().blockEvents();
  25.       Broadcaster.Instance.doPause();
  26.    }
  27.    function unPauseGame()
  28.    {
  29.       this.bPause = false;
  30.       CTRLGame.getRef().unBlockEvents();
  31.       Broadcaster.Instance.doUnPause();
  32.    }
  33.    function isPaused()
  34.    {
  35.       return this.bPause;
  36.    }
  37.    function isSoundsMuted()
  38.    {
  39.       return this.oSounds.isSoundsMuted();
  40.    }
  41.    function muteSounds()
  42.    {
  43.       this.oSounds.DoMuteSounds();
  44.    }
  45.    function unMuteSounds()
  46.    {
  47.       this.oSounds.UndoMuteSounds();
  48.    }
  49.    function isMusicMuted()
  50.    {
  51.       return this.oSounds.isMusicMuted();
  52.    }
  53.    function muteMusic()
  54.    {
  55.       this.oSounds.DoMuteMusic();
  56.    }
  57.    function unMuteMusic()
  58.    {
  59.       this.oSounds.UndoMuteMusic();
  60.    }
  61.    function goTo(_sGoingTo, _classToMove)
  62.    {
  63.       this.oTransition.goTo(_sGoingTo,_classToMove);
  64.    }
  65.    function goToNewLevel(_nFrameSongs)
  66.    {
  67.       this.oTransitionLevel.goToNewLevel(_nFrameSongs);
  68.    }
  69.    function resetForNewGame()
  70.    {
  71.       this.bPause = false;
  72.    }
  73.    function playRollOverSound()
  74.    {
  75.       this.oSounds.playSound("Button_rollover",Controller.nSFX_VOLUME,1);
  76.    }
  77.    function playClickSound()
  78.    {
  79.       this.oSounds.playSound("Button_click",Controller.nSFX_VOLUME,1);
  80.    }
  81.    function introComplete()
  82.    {
  83.       if(Main.getRef().getSection() == Main.PACKAGING_SECTION)
  84.       {
  85.          this.oSounds.playSound(Controller.PACKAGING_MUSIC_NAME,Controller.nMUSIC_VOLUME,999999);
  86.       }
  87.    }
  88.    function playMusicLoop(_sSectionToPlay)
  89.    {
  90.       if(_sSectionToPlay == Main.PACKAGING_SECTION)
  91.       {
  92.          this.oSounds.startFadeOut(Controller.GAME_MUSIC_NAME);
  93.          this.oSounds.startFadeIn(Controller.PACKAGING_INTRO_MUSIC_NAME,Controller.nMUSIC_VOLUME,1);
  94.       }
  95.       else if(_sSectionToPlay == Main.GAME_SECTION)
  96.       {
  97.          this.oSounds.startFadeOut(Controller.PACKAGING_INTRO_MUSIC_NAME);
  98.          this.oSounds.startFadeOut(Controller.PACKAGING_MUSIC_NAME);
  99.          this.oSounds.startFadeIn(Controller.GAME_MUSIC_NAME,Controller.nMUSIC_VOLUME,999999);
  100.       }
  101.    }
  102.    static function getRef()
  103.    {
  104.       return Controller.oRef;
  105.    }
  106.    function getInstructions()
  107.    {
  108.       return this.oInstructions;
  109.    }
  110.    function getSounds()
  111.    {
  112.       return this.oSounds;
  113.    }
  114.    function getMenu()
  115.    {
  116.       return this.oMenu;
  117.    }
  118.    function getStartPop()
  119.    {
  120.       return this.oStartPop;
  121.    }
  122.    function getCheatPop()
  123.    {
  124.       return this.oCheatPop;
  125.    }
  126. }
  127.